#ifndef     __ANALOG_H
#define     __ANALOG_H

#include "../utils/nocopyable.h"
#include "../utils/object.h"
#include "../conn/conn_type.h"

namespace driver {

class Analog {

public:
    Analog();

#if defined(BOARD_PIPE_LINE)
    inline bool is_drop_motor_locked() {
        return value() >= 300;
    }
#endif

#if defined(BOARD_PICK)
    inline bool is_pick_motor_locked() {
        return value() >= 250;
    }
#endif

#if defined(BOARD_HEAT)
    inline bool is_stir_box_motor_locked() {
        return value() >= 500;
    }
    inline bool is_ice_locked() {
        return value() >= 10;
    }
    inline bool is_water_locked() {
        return value() >= 10;
    }
#endif

#if defined(BOARD_POWDER)
    inline bool is_updown_locked() {
        return value() >= 1500;
    }
    inline bool is_dump_locked() {
        return value() >= 600;
    }
#endif

    inline uint16_t value() { return m_values[0]; }

    uint16_t change_value();

private:
    uint16_t m_values[1];

    uint16_t m_last = 0;
};

inline utils::Object<Analog> analog;

}


#endif
